package com.wy;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.SpringCloudApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/*@SpringBootApplication
@EnableDiscoveryClient  //注册服务，并从服务中获取服务列表
@EnableCircuitBreaker  //开启熔断*/
//使用springCloudApplication注解代替上面的组合注解
@SpringCloudApplication
@EnableFeignClients //开启feign伪装rest请求
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

     @Bean
     @LoadBalanced  //负载均衡，ribbon
     public RestTemplate restTemplate(){
             return new RestTemplate();
     }
}
